package com.etime.shycourse.services.coupons.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.etime.shycourse.services.coupons.interfaces.CoupontypeServices;
import com.etime.shycourse.dao.CoupontypeMapper;
import com.etime.shycourse.pojo.Coupontype;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wb
 * @since 2022-03-15
 */
@Service
public class CoupontypeServiceImpl implements CoupontypeServices {

    @Autowired
    private CoupontypeMapper mapper;


    /**
     * 查询优惠劵的大类型型
     *
     * @param
     * @return Coupontype
     */
    @Override
    public List<Coupontype> selectCouponTypeAll() {
        return mapper.selectList (new QueryWrapper<Coupontype> ().eq ("coupontypepid", -1));
    }

    /**
     * 查询优惠劵的小类型
     *
     * @return Coupontype
     */
    @Override
    public List<Coupontype> selectCouponTypeSmallTypeAll() {
        return mapper.selectList (new QueryWrapper<Coupontype> ().ne ("coupontypepid", -1));

    }

    /**
     * 根据优惠劵的大类型
     * 查询优惠劵的小类型
     *
     * @param pId
     * @return Coupontype
     */
    @Override
    public List<Coupontype> selectCouponTypeListById(Integer pId) {
        return mapper.selectList (new QueryWrapper<Coupontype> ().eq ("coupontypepid", pId));
    }
}
